Product: | ISaGRAF 4.1x |
Date: | 24-August-2001 |
File: | Access to system variables from the target.htm |
Subject: | How to access to system variables (or to other variables from their VA) from an IO driver |
Keywords: | System variables - VA - I/O drivers- BF_xxx macros |
_____________________________________________________________________________________________
Here is the way to access system variables from an I/O
driver.
Note that:
The system variables VAs are defined in the file:
dsy0sdef.h: look for defines begining with
ISA_SYSVA_
or look at the end of this FAQ (not all listed).
To access to them:
You must first get the pointer to the begining of the variable
table (real-time database of the Virtual machine).
When you are in an IO driver you have the pointer to a channel of
your device: call it pChannel.
strRtIoChan* pChannel;
uchar *curBfData = NULL;
pChannel = pRtIoSplDvc->pRtIoChan;
curBfData = (uchar*)pChannel->pvKerData -
pChannel->KerVa;
With curBfData you get the pointer to the first variable, then with the following macros you can get the variables you want:
BF_BOOL(BfData,va)
BF_SINT(BfData,va)
BF_DINT(BfData,va)
BF_REAL(BfData,va)
BF_TIME(BfData,va)
with 'va' equals to the Virtual Address of the variable you want to access.
Example: BF_DINT(curBfData,ISA_SYSVA_TCYCURRENT)
__________________________________________________________________________________________
list of system variables
In the R/W column:
Variable Name | TYPE | R/W | Meaning |
ISA_SYSVA_CCEXEC |
BOOL | W | Execute one cycle when application is in cycle to cycle mode |
ISA_SYSVA_CYCLECNT |
DINT | R | Cycle counter |
ISA_SYSVA_KVBPERR |
BOOL | R/W | Kernel variable binding production error |
ISA_SYSVA_KVBCERR |
BOOL | R/W | Kernel variable binding consumption error |
ISA_SYSVA_RESMODE |
SINT | R | Resource execution mode |
ISA_SYSVA_RESNAME |
STRING | R | Resource name (max length=255) |
ISA_SYSVA_SCANCNT |
DINT | R | Input scan counter |
ISA_SYSVA_TCYCYCTIME |
TIME | R/W | Programmed cycle time |
ISA_SYSVA_TCYCURRENT |
TIME |
R |
Current cycle time |
ISA_SYSVA_TCYMAXIMUM |
TIME |
R |
Maximum cycle time since last start |
ISA_SYSVA_TCYOVERFLOW |
DINT |
R |
Number of cycle overflows |
ISA_SYSVA_WNGARG |
DINT | R | Warning Argument |
ISA_SYSVA_WNGCMPTNM |
STRING | R | Warning component name |
ISA_SYSVA_WNGCMD |
SINT | R/W | Warning command. Set it to 1 to get next warning |
ISA_SYSVA_WNGNUM |
DINT | R | Warning Number |
_____________________________________________________________________________________________
Copyright © 1999-2009 ICS Triplex ISaGRAF Inc. All rights reserved.